package org.example.intern.utils;

import java.util.Random;

/**
 * @author: world
 * @date: 2022/4/18 17:15
 * @description: 字符串工具
 */
public class StrUtils {
    public static String getRandomString(int length){
        String str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        Random random=new Random();
        StringBuffer sb=new StringBuffer();
        for(int i=0;i<length;i++){
            int number=random.nextInt(62);
            sb.append(str.charAt(number));
        }
        return sb.toString();
    }

    public static int getRandomInt(Integer max){
        return (int) (Math.random() * max);
    }
}
